// path模块专门用来对路径进行操作的

const path = require("path");

// 路径拼接resolve
console.log(path.resolve("/a", "/b"))  // C:\b
console.log(path.resolve("/a", "b")) // C:\a\b
console.log(path.resolve("/a", "./b")) // C:\a\b
console.log(path.resolve(__dirname, "a", "./b")) // C:\Users\wang\Desktop\数产理\0928\02-常见的内置模块\a\b
console.log(path.resolve(__dirname, "../dpm231/index.js")) //C:\Users\wang\Desktop\数产理\0928\dpm231\index.js



// 获取路径的目录名dirname
console.log(path.dirname("C:/Users/wang/Desktop/数产理/0928/dpm231/index.js"));



// 获取文件的扩展名extname
console.log(path.extname("C:/Users/wang/Desktop/数产理/0928/dpm231/index.js"));
console.log(path.extname("abc.jpg"));
